<template>
  <div v-if="visible" class="overlay">
    <div class="dialog">
      <div class="dialog-header">
        <h3 class="dialog-title">匹配标注</h3>
        <span class="close-icon" @click="close">&times;</span>
      </div>
      <el-input placeholder="请输入搜索内容，支持正则表达式" v-model="searchQuery" />
      <div class="match-options">
        <div v-for="option in options" :key="option.label" class="match-option">
          <el-radio :label="option.label" v-model="selectedOption">
            <span :style="{ color: option.color }">{{ option.label }}</span>
          </el-radio>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { ElInput, ElRadio } from 'element-plus'

export default {
  components: {
    ElInput,
    ElRadio
  },
  props: ['visible'],
  data() {
    return {
      searchQuery: '',
      selectedOption: null,
      options: [
        { label: '将匹配结果标注为人', color: '#00bcd4' },
        { label: '将匹配结果标注为时间', color: '#9c27b0' },
        { label: '将匹配结果标注为地点', color: '#ff9800' },
        { label: '将匹配结果标注为职官', color: '#4caf50' },
        { label: '将匹配结果标注为书', color: '#f44336' }
      ]
    };
  },
  methods: {
    confirm() {
      console.log('搜索内容:', this.searchQuery, '选项:', this.selectedOption);
      this.close();
    },
    close() {
      this.$emit('close');
    }
  }
}
</script>

<style scoped>
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.dialog {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 400px;
  position: relative;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-title {
  margin-top: 2px;
  margin-left: 2px;
}

.close-icon {
  cursor: pointer;
  font-size: 30px;
  color: #aaa;
  margin-bottom: 10px;
}

.match-options {
  margin-top: 20px;
}

.match-option {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.button-container {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.confirm-button,
.cancel-button {
  background-color: #595a59;
  color: white;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 5px;
}

.confirm-button:hover,
.cancel-button:hover {
  background-color: #908e8e;
  color: #000f01;
}
</style>
